ARG PHP_VERSION
FROM php:${PHP_VERSION}-fpm AS php73-fpm

LABEL maintainer="Anrai <anrai@huanglei.me>"

ARG MORE_EXTENSION_INSTALLER

COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions

ENV MC="-j$(nproc)"

# 扩展依赖
RUN export MC="-j$(nproc)" \
    && mv /etc/apt/sources.list /etc/apt/sources.list.bak \
    && mv sources.list /etc/apt/sources.list \
    && chmod +x install.sh \
    && chmod +x "${MORE_EXTENSION_INSTALLER}" \
    && sh install.sh \
    && sh "${MORE_EXTENSION_INSTALLER}"

RUN apt-get clean && apt-get autoremove
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

WORKDIR /home/projects